﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<CRM.Database.Model.Customers>" %>

<%@ Import Namespace="CRM.Resourses" %>


<% Html.DevExpress().GridView(settings =>
                                    {
                                        settings.Name = "gdBonuses";
                                        settings.KeyFieldName = "IdBonus";
                                        settings.CallbackRouteValues =
                                            new { Controller = "Contracts", Action = "CustomerBonusPartial", customerId = Model.IdCustomer };
                                        settings.SettingsPager.PageSize = 20;

                                       

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.RegistrationDate;
                                            column.FieldName = "RegistrationDate";
                                            column.ColumnType = MVCxGridViewColumnType.DateEdit;
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.LegalEntityName;
                                            column.FieldName = "LegalEntityName";
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.DistributorAndProduct;
                                            column.FieldName = "DistributorAndProduct";
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.Value;
                                            column.FieldName = "Value";
                                        });


                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.Basement;
                                            column.FieldName = "Basement";
                                            column.ColumnType = MVCxGridViewColumnType.Memo;
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.BonusType;
                                            column.FieldName = "BonusTypeStr";
                                            
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.Amount;
                                            column.FieldName = "Amount";

                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.BonusStatus;
                                            column.FieldName = "BonusStatusStr";

                                        });
                                        
                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.SigningDate;
                                            column.FieldName = "SigningDate";
                                            column.ColumnType = MVCxGridViewColumnType.DateEdit;
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.ClosingDate;
                                            column.FieldName = "ClosingDate";
                                            column.ColumnType = MVCxGridViewColumnType.DateEdit;
                                        });


                                       

                                       

                                        
                                        //Добавление редактирования
                                        //settings.CommandColumn.Visible = true;
                                        //settings.CommandColumn.NewButton.Visible = true;
                                        //settings.CommandColumn.DeleteButton.Visible = true;
                                        //settings.CommandColumn.EditButton.Visible = true;
                                        //settings.SettingsBehavior.ConfirmDelete = true;
                                        //settings.Settings.ShowFilterRow = true;
                                        //settings.SettingsEditing.UpdateRowRouteValues = new { Controller = "Dictionaries", Action = "ProfineEssentialElementsPartialUpdate" };
                                        //settings.SettingsEditing.AddNewRowRouteValues = new { Controller = "Dictionaries", Action = "ProfineEssentialElementsPartialAdd" };
                                        //settings.SettingsEditing.DeleteRowRouteValues = new { Controller = "Dictionaries", Action = "ProfineEssentialElementsPartialDelete" };
                                      //  settings.SettingsEditing.Mode = GridViewEditingMode.EditFormAndDisplayRow;
                                      //  settings.Width = Unit.Percentage(100);
                                    }).Bind(Model.Bonuses).GetHtml();
                                    
                                    
                                    %>